﻿@model PracticeAzure.Website.Models.CorrigendumDetailsViewModel

@{
    ViewBag.Title = "勘误详情";
}

@section scripts{
    <script type="text/javascript">
        $(function () {
            $(".avatar-path").each(function () {
                $(this).next().attr("src", $(this).val());
            });
        })
    </script>
}

<h2>@Model.Corrigendum.Title</h2>
<a name="top"></a>
@Html.DisplayFor(model => model, "Pager")

<table style="width: 100%;">

    @{
        var tuple = new Tuple<PracticeAzure.Website.Data.Corrigendum, IEnumerable<PracticeAzure.Website.Data.CorrigendumAttachment>>(Model.Corrigendum, Model.Attachments);
    }
    @Html.DisplayFor(model => tuple, "Corrigendum")

    @foreach (var reply in Model.Replies)
    { 
        @Html.DisplayFor(mode => reply)
    }

    @if (PracticeAzure.Website.Shared.GlobalConfiguration.AllowReply)
    { 
        <tr>
            <td style="width: 10%; background-color: rgb(239, 240, 243); font-size: 0.8em; vertical-align: top;"></td>
            <td style="background-color: rgb(239, 240, 243); ">
                <div class="reply-box" style="width: 75%; ">
                    @using (Html.BeginForm("Reply", "Corrigendum"))
                    { 
                        @Html.Hidden("id", Model.Corrigendum.ID)
                        <p>
                            回复：<br />
                            @Html.TextArea("reply", new { style = "width: 100%; height: 250px;", required = "required" })<br />
                        </p>
                        <p>
                            邮件：（不会显示在页面中）<br />
                            @Html.TextBox("email", null, new { style = "width: 50%;" }) （将会显示您在<a href="http://gravatar.com/">gravatar</a>中的头像）
                            <input type="submit" value="提交" style="width: 100px;" />
                        </p>
                    }
                </div>
                <div>
                    <a name="reply-box" href="@Html.Raw(Url.Action("Details", new { id = Model.Corrigendum.ID }) + "#top")">返回顶部</a>
                </div>
            </td>
        </tr>
    }
</table>

@Html.DisplayFor(model => model, "Pager")